<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品详细信息</title>

<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	function vali() {

		var value = $("#valiquantity").val();
		var quantity = $
		{
			goods.zybquantity
		}
		;

		alert(quantity);
		var reg = new RegExp("^[0-9]*$");
		var result = reg.test(value);
		if (result == false) {

			$("#quantity").html("必须为数字").css("color", "red");
			return false;
		}
		if (value > quantity) {

			$("#quantity").html("购买超量").css("color", "red");
			return false;
		}
		return false;
	}

	function retu() {

		window.opener.document.location.reload();
		window.close();

	}
	function logout() {

		window.location.href = "/logout";
	}
</script>
</head>
<body>
	<input type="button" value="注销" onclick="logout();" />
	<div class="container">
		<div class="jumbotron well">
			<h3>在线商城</h3>
			<p>买买买！</p>
		</div>
		<ul class="breadcrumb">
			<li><a href="#">在线商城</a></li>
			<li class="active">商品列表</li>
		</ul>
		<table class="table table-bordered">
			<thead>
				<tr>
					<th colspan="2">商品详细信息</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>商品名称</td>
					<td>${goods.zybgoodname }</td>
				</tr>
				<tr>
					<td>商品单价</td>
					<td>${goods.zybprice }</td>
				</tr>
				<tr>
					<td>库存</td>
					<td>${goods.zybquantity }</td>
				</tr>
				<tr>
					<td>商品简介</td>
					<td>${goods.zybgooddesc	}</td>
				</tr>
			</tbody>
		</table>


		<form class="form-horizontal" action="/cart/add" method="post">
			<input type="hidden" name="zybgoodid" value="${goods.zybgoodid }" />

			<label for="lastname" class="col-sm-2 control-label">请输入购买数量:</label>
			<input type="hidden" name="zybuserid"
				value="${sessionScope.u.zybuserid}"> <input type="hidden"
				name="zybgoodid" value="${goods.zybgoodid}"> <input
				type="number" min="1" max="${goods.zybquantity }" name="zybnumber"
				id="valiquantity" value="1">
			<div id="quantity"></div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="submit" class="btn btn-primary" value="加入购物车">
					<a href="#" class="btn btn-danger" onclick="retu();">返回</a>
				</div>
			</div>
		</form>
	</div>
</body>
</html>